const Type = "string"
//封装

//保存localstorage
export const setStorage = (key, data) => {
    if (!key) {
        return
    }
    if(typeof(data)!=Type){
        data = JSON.stringify(data)
    }
    localStorage.setItem(key,data)
}
//删除localstorage
export const gerStorage = (key)=>{
  if(!key){
      return
  }
  localStorage.removeItem(key)
}

//清空localstorage
export const clearStorage = ()=>{
    localStorage.clear()
}